<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title> - 创建亲友圈</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="favicon.ico"> <link href="__STATIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__STATIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__STATIC__/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
	<link href="__STATIC__/css/animate.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="__STATIC__/css/information.css" />
	<link href="__STATIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<link href="__STATIC__/css/new_file.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox ">
				<div class="ibox-title">
					<h5>创建亲友圈</h5>
				</div>
				<div class="toogl_body">
					<a href="Club.html"><button type="button" class="btn btn-w-m btn-bt btn-white">亲友圈管理</button></a>
					<a href="Club_configure.html"><button type="button" class="btn btn-w-m btn-white btn-bt">蓝钻商城配置</button></a>
					<a href="Club_goldcoin.html"><button type="button" class="btn btn-w-m btn-white btn-bt">黄钻商城配置</button></a>
					<a href="Club_vipcard.html"><button type="button" class="btn btn-w-m btn-white btn-bt">会员卡商城配置</button></a>
					<a href="Club_establish.html"><button type="button" class="btn btn-w-m btn-info btn-bt">创建亲友圈</button></a>
					<!--<a href="Club_grant.html"><button type="button" class="btn btn-w-m btn-white btn-bt">金币发放</button></a>-->
					<a href="Club_conf.html"><button type="button" class="btn btn-w-m btn-white btn-bt">亲友圈配置</button></a>
					<a href="Club_from.html"><button type="button" class="btn btn-w-m btn-white btn-bt">房间配置</button></a>
					<hr style="clear: both;"/>
					<div class="ibox-content ibox-jqGrid">
						<div class="form-group mmp-gbl"><br/>
							<label class="col-sm-2 control-dy"  style='width:88px'>亲友圈名称：</label>
							<div class="col-sm-8 form-time1">
								<input type="text" placeholder="请输入亲友圈名称" class="form-control form-time-bk" id="club_name">
							</div>
							<label class="col-sm-2 control-dy">创建人ID：</label>
							<div class="col-sm-8 form-time1">
								<input type="text" placeholder="请输入创建人ID" class="form-control form-time-bk" id="player_id" />
							</div>
							{if ($auth == '管理员') }

							<label class="col-sm-2 control-dy">高级会长ID：</label>
							<div class="col-sm-8 form-time1">
								<input type="text" placeholder="请输入高级会长ID" class="form-control form-time-bk" id="Senior_president" />
							</div>
							{/if}
							<label class="col-sm-2 control-dy">返利比例：</label>
							<div class="col-sm-8 form-time1">
								<input type="text" value="10" placeholder="请输入返利比例" class="form-control form-time-bk" id="rebate" />
							</div>
							<label class="col-sm-2 control-dy" style="width: 15px;">%</label>
							<label class="col-sm-2 control-dy " style='width:88px'>商业模式：</label>
							<div class="col-sm-8 form-time1">
								<select  id="club_type" class="form-control">
									<option value="0">分成模式</option>
									<option value="1">免费模式</option>
								</select>　
							</div>
							<label class="col-sm-2 control-dy " style='width:88px'>房费配置项：</label>
							<div class="col-sm-8 form-time1">
								<select  id="room_rate" class="form-control">
									<option value="0">均摊模式</option>
									<option value="1">大赢家模式</option>
								</select>　
							</div>
							<label class="col-sm-2 control-dy " style='width:88px'>所属地区：</label>
							<div class="col-sm-8 form-time1">
								<select  id="area"  class="form-control">
									<option value="">请选择所属地区</option>
								</select>　
							</div><br style="clear: both"/>
							<button type="button" class="btn btn-w-m btn-primary" data-toggle="modal" data-target="#myModal" id="form_games">选择玩法</button>
							<button type="button" class="btn btn-w-m btn-info" onclick="_checkedPost()">创建</button>

						</div>
						<div class="jqGrid_wrapper" id="tab-q">
							<table id="table_list_1"></table>
							<div id="pager_list_1"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 弹出  详情   -->
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div id="gray_Nr">
		<div class="col-sm-4 acco-tc">
			<div class="ibox float-e-margins float-e-margins-xiao">
				<div class="ibox-title">
					<h5>选择玩法</h5>
					<div class="ibox-tools" data-dismiss="modal">
						<a class="close-link">
							<i class="fa fa-times"></i>
						</a>
					</div>
				</div>
				<div class="province_bod">
					<div class="province_1" id="game" style="width: 100%">
						<p class="province_top">选择玩法</p>
					</div>
				</div>
				<div class="ibox-butz">
					<input class="btn btn-w-m " type="button" id="all" style="background-color:#B4CDCD" value="全选">
					<input class="btn btn-w-m " type="button" id="Uall" style="background-color:#A9A9A9" value="取消全选">
					<input class="btn btn-w-m btn-info" type="button" id="button_ban_user" data-dismiss="modal" value="确定">
					<input class="btn btn-w-m" type="button" data-dismiss="modal" id="cancel" value="取消">
				</div>
			</div>
		</div>
	</div>
</div>
<!--弹出end  详情-->
<!--手机导航-->
<div class="to-fdh" style="display: none;">
	<img class="to-imgd" src="__STATIC__/img/phonedh.jpg">
	<div class="mob-nrlb">
		<ul>
			<li>
				<a class="mob-nrdh">管理</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('Player/gameplayer')}">玩家管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('system/notice')}">公告管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('email/mail')}">邮件管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Club/club')}">亲友圈管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Money/money')}">提现管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('Order/order')}">订单管理</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh">数据</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('data/datagk')}">概況</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datawf')}">玩法</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datalc')}">留存</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/datass')}">实时数据</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataczfx')}">充值分析</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/dataclub')}">亲友圈统计</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/president')}">高级会长</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('data/regionaldata')}">地区数据</a>
					</li>
				</ul>
			</li>
			<li>
				<a class="mob-nrdh mob-qbh">权限</a>
				<ul class="mob-nryc">
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_list')}">权限管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('rule/rule_group')}">用户组管理</a>
					</li>
					<li class="mob-nrdhli">
						<a href="{:url('account/account_details')}">后台账号管理</a>
					</li>
				</ul>
			</li>
		</ul>
	</div>
</div>
<div id="zkbg">
	<img src="__STATIC__/img/dp.gif">
</div>
<div class="vnl-zz" style="display:none">
	<div><img src="__STATIC__/img/bqhp.gif"></div>
</div>
<!--手机适配-->
<script src="__STATIC__/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__STATIC__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__STATIC__/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
<script src="__STATIC__/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
<script src="__STATIC__/js/content.js?v=1.0.0"></script>
<script src="__STATIC__/js/plugins/laydate/laydate.js"></script>
<script>
    //手机适配
    $(function(){
        if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
            $("head").append("<link>");
            var css = $("head").children(":last");
            css.attr({
                rel:  "stylesheet",
                type: "text/css",
                href: "__STATIC__/css/phone_sp.css"
            });
            var mql = window.matchMedia("(orientation: portrait)");
            if(mql.matches) { //竖屏样式
                $(".vnl-zz").show();
                $(".to-fdh").hide();
            }else{
                $(".to-fdh").show();
                $("html").width("100%");
                $("body").width("100%");
            }
            mql.addListener(function(m) {
                if(m.matches) {
                    // 改变到直立方向
                    $(".vnl-zz").show();
                    $(".to-fdh").hide();
                }
                else {
                    $(".to-fdh").show();
                    $(".vnl-zz").hide();
                    $("html").width("100%");
                    $("body").width("100%");
                }
            });
        }
    });
    //导航显示展开
    $(".mob-nrdh").click(function(){
        $(this).next().toggle(".mob-nryc");
    });
    $(".to-imgd").click(function(){
        $(this).next().toggle(".mob-nrlb");
    });
    //手机适配end
    //游戏
    $(function() {
        $.ajax({
            type: "post",
            url: "{:url('account/Owngame')}",
            data: {},
            dataType: "json",
            success: function(e) {
                console.log(e);
                for(i in e) {
                    $("#game").append( "<p class='province_nr pre_n1'><span>"+e[i].name+"</span><input type='checkbox' class='fa province_jt bxd_chox play' name='game' value='"+e[i].id+"'></p>");

                }
            },
            error: function(e) {
                console.log(e);
            }
        });
    });
    $("#all").click(function() {
        $("input[type=checkbox].play").each(function() {
            // if(this.checked == true){
            //     $(this).prop('checked', false);
            // }else{
            $(this).prop('checked', true);
            // }

        });

    });
    $("#Uall").click(function() {
        $("input[type=checkbox].play").each(function() {
            $(this).prop('checked', false);

        });

    });
    $("#cancel").click(function() {
        $("input[type=checkbox].play").each(function () {
            $(this).attr('checked',false);
        });
    });
    $(function () {
        $.ajax({
            type: "post",
            url: "{:url('account/Area')}",
            data: {},
            dataType: "json",
            success: function(e) {
                for(i in e){
                    $("#area").append('<option value="' + e[i].aid + '">' + e[i].area_name + '</option>');
                }
            },
            error: function(e) {}
        });
    });
    function _checkedPost() {
        var player_id = $("#player_id").val();
        var club_name = $("#club_name").val();
        var club_type = $("#club_type").val();
        var area = $("#area").val();
        var Senior_president = $("#Senior_president").val();
        var rebate= $("#rebate").val();
        var game = new Array();
        var room_rate = $("#room_rate").val();
        $("input[type=checkbox].play").each(function() {
            if($(this).prop("checked") == true){
                game.push($(this).val());
            }
        });
        var limitation = 1;
        if(club_name ==""){
            alert("请输入亲友圈名称");
            return false;
        }
        if(club_name.length >6){
            alert("亲友圈名称请限制在6个汉字以内");
            return false;
        }
        if(player_id == ""){
            alert("请输入创建人ID");
            return false;
        }
        if(area == ""){
            alert("请选择所属区域");
            return false;
        }
        if(game == ""){
            alert("请选择玩法");
            return false;
        }


        $.ajax({
            type: "post",
            url: "__URL__/Club_create",
            data: {
                "player_id":player_id,
                "club_name": club_name,
                'limitation':limitation,
                'club_type':club_type,
                'area':area,
                'game':game,
                'Senior_president':Senior_president,
                'rebate':rebate,
                'room_rate':room_rate
            },
            dataType: "json",
            success: function(e) {
                console.log(e);
                alert(e.msg);
                location.reload();
            },
            error: function(e) {}
        });
        // }
    }
    $(document).ready(function () {

        $.jgrid.defaults.styleUI = 'Bootstrap';

        $("#table_list_1").jqGrid({
            url:'__URL__/create_record_limit',
            postData:{},
            datatype: "json",
            mtype: 'POST',
            height: 450,
            autowidth: true,
            shrinkToFit: true,
            rowNum: 20,
            rowList: [10, 20, 30],
            colNames: ['操作时间', '操作人', '亲友圈名称', '创建人ID'],
            colModel: [
                {
                    name: 'opera_time',
                    index: 'opera_time',
                    width: 60,
                    sorttype: "int",
                    sortable: false,
                    align:'center'
                },
                {
                    name: 'opera_pepole',
                    index: 'opera_pepole',
                    width: 60,
                    sorttype: "int",
                    sortable: false,
                    align:'center'
                },
                {
                    name: 'club_name',
                    index: 'club_name',
                    width: 60,
                    sorttype: "int",
                    sortable: false,
                    align:'center',
                },
                {
                    name: 'player_id',
                    index: 'player_id',
                    width: 60,
                    sorttype: "int",
                    sortable: false,
                    align:'center'
                }
            ],
            pager: "#pager_list_1",
            viewrecords: true,
            loadonce: true,
            caption: "创建亲友圈",
            hidegrid: false
        });


        setTimeout(function(){
            var width = $('.jqGrid_wrapper').width();
            $('#table_list_1').setGridWidth(width);
        },500);


        $("#jd").hide();
        $(function(){
            $("#jd").click(function(){
                $("#jd").hide();
                $("#dj").show();
            });
            $("#dj").click(function(){
                $("#dj").hide();
                $("#jd").show();
            });
        });
        $("#fj").hide();
        $(function(){
            $("#fj").click(function(){
                $("#fj").hide();
                $("#jj").show();
            });
            $("#jj").click(function(){
                $("#jj").hide();
                $("#fj").show();
            });
        });
        $('.form-conselein').hide();
        $('.form-consele').on('change',function(){
            if ($('.form-consele').val() == '0') {
                $('.form-conselein').hide();
            } else{
                $('.form-conselein').show();
            }
        });
    });
    laydate.render({
        elem: '#time1',
        range: true
    });
    laydate.render({
        elem: '#time2'
        ,range: true
    });
</script>


</body>

</html>